// 验证手机号码
const validatePhone = (phone) => {
  const phoneRegex = /^1[3-9]\d{9}$/;
  if (!phoneRegex.test(phone)) {
    uni.showToast({
      title: "请输入正确的手机号",
      icon: "none",
    });
    return;
  }
};

// 验证验证码
const validateCode = (code) => {
  const codeRegex = /^\d{6}$/;
  return codeRegex.test(code);
};

// 验证营业执照
const validateBusinessLicense = (image) => {
  if (!image) {
    uni.showToast({
      title: "请上传营业执照",
      icon: "none",
    });
  }
  return !!image;
};

// 验证身份证号码
const validateIDCard = (idCard) => {
  const idCardRegex = /^\d{17}[\dX]$/;
  return idCardRegex.test(idCard);
};
export { validatePhone, validateCode, validateBusinessLicense, validateIDCard };
